package com.sgxy.wmservice.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sgxy.commonutils.R;
import com.sgxy.wmservice.entity.WmStoreGoods;
import com.sgxy.wmservice.entity.vo.StoreGoodsVo;
import com.sgxy.wmservice.service.WmStoreGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author testjava
 * @since 2022-04-29
 */
@RestController
@RequestMapping("/wmservice/wmstoregoods")
public class WmStoreGoodsController {

    @Autowired
    private WmStoreGoodsService wmStoreGoodsService;
    @PostMapping("{page}/{limit}")
    public R index(@PathVariable Long page,
                   @PathVariable Long limit,
                   @RequestBody(required = false) WmStoreGoods wmStoreGoods){
        Page<StoreGoodsVo> empPage = new Page<>(page,limit);
        wmStoreGoodsService.selectPageVoList(empPage, wmStoreGoods);
        //System.out.println(aclEmpVos);
        //System.out.println(empPage.getRecords());
        return R.ok().data("items",empPage.getRecords()).data("total",empPage.getTotal());
    }
    @GetMapping("getSGInfoById/{id}")
    public R getEmpInfoById(@PathVariable String id){
        StoreGoodsVo storeGoodsVo = wmStoreGoodsService.getSGInfoById(id);
        return R.ok().data("storeGoodsVo",storeGoodsVo);
    }


}

